

from django.db.models import CharField,IntegerField,ForeignKey,DO_NOTHING,TextField,DateField,DateTimeField,BooleanField
from apps.vadmin.op_drf.models import CoreModel

"""
软件许可件可借出给资产或人且需要归还
"""
class LicenseRecords(CoreModel):
    license = ForeignKey(to="assets.Licenses",null=True,db_constraint=False,on_delete=DO_NOTHING,verbose_name="借出Licenses的Id")
    assigned_to = ForeignKey(to="permission.UserProfile",null=True,db_constraint=False,on_delete=DO_NOTHING,related_name='licenses_assigned_user',verbose_name="借用人")
    assigned_asset = ForeignKey(to="assets.Assets",null=True,db_constraint=False,on_delete=DO_NOTHING,verbose_name="借用资产") 
    checkin_datetime = DateTimeField(null=True,verbose_name="实际归还时间")
    is_checkin = BooleanField(null=True,default=0,verbose_name="是否归还")
    checkout_notes = TextField(null=True,verbose_name="借出备注")
    checkin_notes = TextField(null=True,verbose_name="归还备注")


    class Meta:
        verbose_name = '软件许可证借用归还记录表'
        verbose_name_plural = verbose_name
